package com.google.code.virtualhockey.vhx.server.model

import com.google.appengine.api.datastore.Entity
import com.google.appengine.api.datastore.GeoPt
import com.google.code.virtualhockey.vhx.sds.STMetaData
import com.google.code.virtualhockey.vhx.sds.fields._
import com.google.code.virtualhockey.vhx.sds.STNamedEntity

/**
 * Represents a club that participates in a VHX game.
 */
class Club( val name: String,
            val nameOfficial: String,
            val place: String,
            val country: String,
            val location: GeoPt ) extends STNamedEntity[Club] {

  /** Private no-arg constructor for SDS. */
  private def this() = this( null, null, null, null, null )
}

object ClubMeta extends STMetaData[Club] {
  val cls = classOf[Club]
  val kind = "Club"
  val fields = List(
    new SShortText( this, "name", true ),
    new SShortText( this, "nameOfficial", false ),
    new SShortText( this, "place", false ),
    new SShortText( this, "country", false ),
    new SGeoPoint( this, "location", false ) )
}